package cn.wenhe9.gulimall.order.controller;

import java.util.Arrays;
import java.util.Map;

import cn.wenhe9.common.utils.ResultResponse;
import com.baomidou.mybatisplus.core.metadata.IPage;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import cn.wenhe9.gulimall.order.entity.OmsOrderReturnApplyEntity;
import cn.wenhe9.gulimall.order.service.OmsOrderReturnApplyService;



/**
 * 订单退货申请
 *
 * @author dujinliang
 * @email dujinliang9@163.com
 * @date 2022-04-14 09:21:59
 */
@RestController
@RequestMapping("order/omsorderreturnapply")
public class OmsOrderReturnApplyController {
    @Autowired
    private OmsOrderReturnApplyService omsOrderReturnApplyService;

    /**
     * 列表
     */
    @RequestMapping("/list")
    //@RequiresPermissions("order:omsorderreturnapply:list")
    public ResultResponse list(@RequestParam Map<String, Object> params){
        IPage<OmsOrderReturnApplyEntity> page = omsOrderReturnApplyService.queryPage(params);

        return ResultResponse.ok(page);
    }


    /**
     * 信息
     */
    @RequestMapping("/info/{id}")
    //@RequiresPermissions("order:omsorderreturnapply:info")
    public ResultResponse info(@PathVariable("id") Long id){
		OmsOrderReturnApplyEntity omsOrderReturnApply = omsOrderReturnApplyService.getById(id);

        return ResultResponse.ok(omsOrderReturnApply);
    }

    /**
     * 保存
     */
    @RequestMapping("/save")
    //@RequiresPermissions("order:omsorderreturnapply:save")
    public ResultResponse save(@RequestBody OmsOrderReturnApplyEntity omsOrderReturnApply){
		omsOrderReturnApplyService.save(omsOrderReturnApply);

        return ResultResponse.ok();
    }

    /**
     * 修改
     */
    @RequestMapping("/update")
    //@RequiresPermissions("order:omsorderreturnapply:update")
    public ResultResponse update(@RequestBody OmsOrderReturnApplyEntity omsOrderReturnApply){
		omsOrderReturnApplyService.updateById(omsOrderReturnApply);

        return ResultResponse.ok();
    }

    /**
     * 删除
     */
    @RequestMapping("/delete")
    //@RequiresPermissions("order:omsorderreturnapply:delete")
    public ResultResponse delete(@RequestBody Long[] ids){
		omsOrderReturnApplyService.removeByIds(Arrays.asList(ids));

        return ResultResponse.ok();
    }

}
